{extend name='extra@admin/content'}
{block name="button"}
<div class="nowrap pull-right" style="margin-top:10px">
    {if auth("$classuri/order")}
        <button data-open='{:url("$classuri/order")}' href="javascript:void(0)" class='layui-btn layui-btn-small '>
            <i class='fa fa fa-bars'></i> 全部订单
        </button>
    {/if}
    {if auth("$classuri/order")}
        <button data-open='{:url("$classuri/order")}?status=1' href="javascript:void(0)" class='layui-btn layui-btn-small layui-btn-danger'>
            <i class='fa fa-exclamation-circle'></i> 已处理
        </button>
    {/if}
    {if auth("$classuri/order")}
        <button data-open='{:url("$classuri/order")}?status=0' href="javascript:void(0)" class='layui-btn layui-btn-small layui-btn-danger'>
            <i class='fa fa-exclamation-circle'></i> （{$new_order}）个订单未处理
        </button>
    {/if}
    {if !empty($list)}
        {if auth("kuguan/export/export_material_order")}
        <a href='{:url("kuguan/export/export_material_order")}?order_sn={$Think.get.order_sn}&date={$Think.get.date}&yw_type={$Think.get.yw_type}&gys={$Think.get.gys}&status={$Think.get.status}' class="layui-btn layui-btn-small" style="text-decoration:none"><i class="fa fa-mail-forward"></i>
            导出
        </a>
        {/if}
    {else /}
        <a href="javascript:;" onclick="no_export();" class="layui-btn layui-btn-small " style="text-decoration:none;"><i class='fa fa fa-mail-forward'></i> 导出</a>
    {/if}
    <!--{if auth("$classuri/order")}-->
    <!--<button data-modal='{:url("$classuri/export")}' href="javascript:void(0)" class='layui-btn layui-btn-small '>-->
    <!--<i class='fa fa fa-mail-forward'></i> 导出订单-->
    <!--</button>-->
    <!--{/if}-->
</div>
{/block}
{block name="content"}
<!-- 表单搜索 开始 -->
<form class="animated form-search" action="__SELF__" onsubmit="return false" method="get">
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">订单号</label>
        <div class="layui-input-inline">
            <input name="order_sn" value="{$Think.get.order_sn|default=''}" placeholder="请输入订单号" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">下单时间</label>
        <div class="layui-input-inline">
            <input name="date" id='range-date' value="{$Think.get.date|default=''}"
                   placeholder="请选择下单时间" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">供应商</label>
        <div class="layui-input-inline">
            <input name="gys" value="{$Think.get.gys|default=''}" placeholder="请输入供应商" class="layui-input">
        </div>
    </div>
    <!--<div class="col-xs-2">-->
    <!--<div class="form-group">-->
    <!--<select name="status"  lay-filter="export" class="input-sm form-control">-->
    <!--<option value="">- 单据状态 -</option>-->
    <!--<option value="0" {if ($Think.get.status eq 0) AND ($Think.get.status nheq '')} selected {/if}>申请中</option>-->
    <!--<option value="1" {if $Think.get.status eq 1} selected {/if}>已处理</option>-->
    <!--</select>-->
    <!--</div>-->
    <!--</div>-->
    <div class="col-xs-2">
        <div class="form-group">
            <select name="yw_type"  lay-filter="export" class="input-sm form-control">
                <option value="">- 业务类型 -</option>
                <option value="1" {if $Think.get.yw_type eq 1} selected {/if}>普通采购</option>
                <option value="2" {if $Think.get.yw_type eq 2} selected {/if}>采购退货</option>
                <option value="3" {if $Think.get.yw_type eq 3} selected {/if}>生产使用</option>
            </select>
        </div>
    </div>
`
    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
    </div>
</form>
<!-- 表单搜索 结束 -->
<form onsubmit="return false;" data-auto="true" method="post">
    {if empty($list)}
    <p class="help-block text-center well">没 有 记 录 哦！</p>
    {else}
    <input type="hidden" value="resort" name="action"/>
    <table class="layui-table" lay-skin="line" lay-size="sm">
        <thead>
            <tr>
                <th class='text-left nowrap'>ID</th>
                <th class='text-left nowrap'>订单编号</th>
                <th class='text-left nowrap'>制单人</th>
                <th class='text-left nowrap'>订单类型</th>
                <th class='text-left nowrap'>预估价</th>
                <th class='text-left nowrap'>交易价</th>
                <!-- <th class='text-left nowrap'>订单总价</th> -->
                <th class='text-left nowrap'>订单状态</th>
                <th class='text-left nowrap'>处理时间</th>
                <th class='text-left nowrap'>审核人</th>
                <th class='text-left nowrap'>供应商</th>
                <th class='text-left nowrap'>创建时间</th>
                <th class='text-left nowrap'>操作</th>
            </tr>
        </thead>
        <tbody>
            {volist name='list' id='vo'}
            <tr>
                <td class='text-left nowrap'>
                    {$vo.id}
                </td>
                <td class='text-left nowrap'>
                    {$vo.order_sn}
                </td>
                <td class='text-left nowrap'>
                    {$vo.create_admin}
                </td>
                <td class='text-left nowrap'>
                    {if condition="$vo.yw_type eq 1"}
                        普通采购
                    {elseif condition="$vo.yw_type eq 2" /}
                        采购退货
                    {else /}
                        生产使用
                    {/if}
                </td>
                <td class='text-left nowrap'>
                    {$vo.price}
                </td>
                <td class='text-left nowrap'>
                    {if $vo.yw_type eq 2}
                        采购退货
                    {else /}
                        {if condition="$vo.is_duizhang eq 0"}
                            暂未对账
                        {else /}
                            {$vo.receive_price}
                        {/if}
                    {/if}
                </td>
                <!-- <td class='text-left nowrap'>
                    {$vo.price}
                </td> -->
                <td class='text-left nowrap'>
                    {if $vo.yw_type neq 1}
                        已处理
                    {else /}
                        {if condition="$vo.status eq 0"}
                            待处理
                        {elseif condition="$vo.status eq 1" /}
                            已处理
                        {/if}
                    {/if}

                </td>
                <td class='text-left nowrap'>
                    {if $vo.yw_type eq 2}
                        {$vo.addtime|date="Y-m-d H:i",###}
                    {else /}
                        {if condition="$vo.receive_time eq ''"}
                            暂未处理
                        {else /}
                            {$vo.receive_time|date="Y-m-d H:i",###}
                        {/if}
                    {/if}
                </td>
                <td class='text-left nowrap'>
                    {if $vo.yw_type eq 2}
                        {$vo.create_admin}
                    {else /}
                        {if condition="$vo.receive_admin neq ''"}
                            {$vo.receive_admin}
                        {else /}
                            暂未处理
                        {/if}
                    {/if}
                </td>
                <td class='text-left nowrap'>
                    {$vo.gys}
                </td>
                <td class='text-left nowrap'>
                    {$vo.addtime|date="Y-m-d H:i",###}
                </td>
                <td class='text-left nowrap'>
                    {if auth("kuguan/export/export_signal_order")}
                        <span class="text-explode">|</span>
                        <a href='{:url("kuguan/export/export_signal_order")}?order_id={$vo.id}' style="text-decoration:none">
            导出
                        </a>
                    {/if}
                    {if auth("$classuri/detail")}
                        <span class="text-explode">|</span>
                        <a data-open='{:url("$classuri/order_detail")}?id={$vo.id}' href="javascript:void(0)">详情</a>
                    {/if}
                </td>
            </tr>
            {/volist}
        </tbody>
    </table>
    {if isset($page)}<p>{$page}</p>{/if}
    {/if}
    <script>
        window.laydate.render({range: true, elem: '#range-date', format: 'yyyy/MM/dd'});

        /**
         * 不能导信息
         */
        function no_export(){
            layer.msg('查询数据为空，不能导出数据',{icon: 2, time: 1500});
            return false;
        }
    </script>
</form>
{/block}